Feature/speech managed identity#543
Conversation
…to the key, added MAG functionality via Azure Speech SDK since the Fast Transcription API is not available in MAG, updated Admin Setup Walkthrough so it goes to the right place in the settings when Next is clicked, updated Speech requirements in Walkthrough, rewrote Admin Configuration docs, updated/corrected Managed Identity roles in Setup Instructions Special docs.
There was a problem hiding this comment.
Pull request overview
This pull request adds speech-to-text functionality for MAG and sovereign clouds, implements Managed Identity authentication for Azure Speech Service, fixes Setup Walkthrough navigation issues, and updates related documentation.
Key changes:
- Adds conditional logic to use Speech SDK instead of Fast Transcription API for sovereign clouds (MAG, custom environments)
- Implements Managed Identity authentication option with dropdown selection for Speech Service
- Fixes Setup Walkthrough navigation to work with both tab and sidebar layouts
- Updates role requirements in documentation for proper Managed Identity permissions
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
docs/setup_instructions_special.md |
Updated endpoint domain references and corrected RBAC role requirements for Managed Identity authentication (Search, Content Safety, Speech Service) |
docs/admin_configuration.md |
Comprehensive rewrite with detailed walkthrough documentation, configuration sections, and navigation options |
application/single_app/templates/admin_settings.html |
Added authentication type dropdown for Speech Service, updated placeholders, corrected walkthrough tab references, and added Managed Identity guidance |
application/single_app/static/js/admin/admin_settings.js |
Enhanced walkthrough navigation to support both tab and sidebar layouts, corrected tab mappings for multimedia settings, improved scrolling behavior, and updated authentication validation logic |
application/single_app/route_frontend_admin_settings.py |
Added speech_service_authentication_type field to form data processing |
application/single_app/requirements.txt |
Added azure-cognitiveservices-speech SDK dependency for sovereign cloud support |
application/single_app/functions_settings.py |
Changed default value of enable_external_healthcheck from True to False |
application/single_app/functions_documents.py |
Implemented conditional logic for Speech SDK in sovereign clouds, added _get_speech_config helper function, and added Managed Identity support for both Fast Transcription API and Speech SDK |
application/single_app/config.py |
Added import for Azure Cognitive Services Speech SDK |
| for idx, chunk_path in enumerate(chunk_paths, start=1): | ||
| print(f"[Debug] Transcribing chunk {idx}: {chunk_path}") | ||
|
|
||
| # Get fresh config (tokens expire after ~1 hour) | ||
| speech_config = _get_speech_config(settings,endpoint, locale) | ||
|
|
||
| audio_config = speechsdk.AudioConfig(filename=chunk_path) | ||
| speech_recognizer = speechsdk.SpeechRecognizer( | ||
| speech_config=speech_config, | ||
| audio_config=audio_config | ||
| ) | ||
|
|
||
| result = speech_recognizer.recognize_once() | ||
| if result.reason == speechsdk.ResultReason.RecognizedSpeech: | ||
| print(f"[Debug] Recognized: {result.text}") | ||
| all_phrases.append(result.text) | ||
| elif result.reason == speechsdk.ResultReason.NoMatch: | ||
| print(f"[Warning] No speech in {chunk_path}") | ||
| elif result.reason == speechsdk.ResultReason.Canceled: | ||
| print(f"[Error] {result.cancellation_details.reason}: {result.cancellation_details.error_details}") | ||
| raise RuntimeError(f"Transcription canceled for {chunk_path}: {result.cancellation_details.error_details}") |
There was a problem hiding this comment.
The update_callback is not being called in the sovereign cloud path (SDK path). When processing audio chunks in the SDK branch, the user won't receive progress updates showing which chunk is being transcribed. Consider adding update_callback(current_file_chunk=idx, status=f"Transcribing chunk {idx}/{len(chunk_paths)}…") inside the SDK loop to maintain consistent user experience across both code paths.
| default_settings = { | ||
| # External health check | ||
| 'enable_external_healthcheck': True, | ||
| 'enable_external_healthcheck': False, |
There was a problem hiding this comment.
Dictionary key 'enable_external_healthcheck' is subsequently overwritten.
| 'enable_external_healthcheck': False, |
| from io import BytesIO | ||
| from typing import List | ||
|
|
||
| import azure.cognitiveservices.speech as speechsdk |
There was a problem hiding this comment.
Import of 'speechsdk' is not used.
| import azure.cognitiveservices.speech as speechsdk |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Feature - Speech-to-text functionality should now work natively in MAG and sovereign clouds
Based on the below documentation, the Fast Transcription API utilized by Simple Chat for speech-to-text transcription is not available in MAG or other sovereign clouds. For those clouds, I added conditional logic to use the Speech SDK instead.
Feature - Added Managed Identity authentication option to Speech Service Settings via drop down

Current Speech Service Settings
Updated Speech Service Settings

Added dropdown selection
API Key

Managed Identity

Managed Identity is configured to work with both the Fast Transcription API in commercial and Speech SDK in MAG and other sovereign & custom clouds.
Feature - Updated Speech Settings in Setup Walkthrough
Changed the required "Key" element to Authentication. If using Key-based auth, a Key will be required, if using Managed Identity auth, the condition will be automatically satisfied.
Current

Updated

With Managed Identity selected
With API Key selected, but no Key entered

Feature/Bugfix - Setup Walkthrough Navigation
The Next and Previous buttons in the App Settings Setup Walkthrough were not working correctly. Updated the navigation settings and also updated/corrected the notes and tooltips.
Doc Updates
Rewrote docs\admin_configuration.md to be current and more comprehensive
Updated docs\setup_instructions_special.md with corrected roles needed for managed identity configuration